/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lc3vm;

/**
 *
 * @author Administrator
 */

import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
//import java.awt.event.*;

public class PanelConsola extends JPanel implements DocumentListener{

    private JTextArea Consola = new JTextArea(30,30);
    private JScrollPane barras;
    private static String Palabra = "";
    private static boolean pausa = true;
    private static char Caracter;
    
    public PanelConsola(){
        setLayout(new FlowLayout());
        Consola.getDocument().addDocumentListener(this);
        Consola.setLineWrap(true);
        Consola.setColumns(45);
        Consola.setRows(10);
        Consola.setWrapStyleWord(true);
        barras = new JScrollPane(Consola);

        add(barras);
        Consola.append("Aqui empieza la onda");
    }

    public static String getPalabra(){
        Palabra = Palabra.substring(1);
        System.out.println();
        return(Palabra);
    }

    public static boolean getPausa(){
        return(pausa);
    }

    public void Imprimir(){
        if(!(Consola.getText().charAt(Consola.getText().length()-1) == '\n'))
            Palabra = Palabra + (Consola.getText().charAt(Consola.getText().length()-1));
        else
            System.out.println(Palabra);
        //System.out.println(Consola.getText().charAt(Consola.getText().length()-1));
    }

    public void catchCaracter(){
        Caracter = Consola.getText().charAt(WIDTH);
    }

    public void getCaracter(){

    }

    public void insertUpdate(DocumentEvent e) {

        Imprimir();
    }

    public void removeUpdate(DocumentEvent e) {

    }

    public void changedUpdate(DocumentEvent e) {

    }


}
